 class Solution(object):
    def subsetXORSum(self, nums):
        ans = 0
        n = len(nums)
        for value in range(2 ** n):
            base = 0
            for i in range(n):
                if (value >> i) & 1 == 1:
                    base ^= nums[i]
            ans += base
        return ans

data = Solution()
nums = [1,3]
print(data.subsetXORSum(nums))
